/*
 * @Author: 卡卡 1071780426@qq.com
 * @Date: 2024-01-16 13:41:16
 * @LastEditors: 卡卡 1071780426@qq.com
 * @LastEditTime: 2024-01-23 14:55:37
 * @FilePath: \zjgxpt\zdgy\src\components\intelligentMaintenanceManage\sampleStorage\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import formJs from "./regexDetail.js"; //新增弹框配置项
import TableData from "@/components/public/el-table"; //主页面列表
import FormLyout from '@/components/commonPublic/fromLayout.vue'
import actions from "@/actions";
import publicForm from "@/components/public/el-form.vue"; //弹框form
import {
    getSampleConserveByFid, //详情
} from "@/api/request.js";
export default {
  
    data() {
        return {
            visible: "",
            title: null,
            loading: false,
            tableData: [],
            searchObj: formJs.searchObj, //搜索条件
            table_config: null, //列表
            queryCriteriaData: {}, //分页
            dialogHeight: null,
            formObj: formJs.formObj,
            isEdit: false,
            currntData: null,
            dataInfo: null,
            formData: {},
            currentDetail: null,
            types:null,
            primaryInfo:null
        };
    },
    components: {
        publicForm,
        TableData,
        FormLyout
    },

   
    mounted() {
        this.primaryInfo = JSON.parse(sessionStorage.getItem("GxEmbedded_primaryInfo"))
        var pageStatus=this.primaryInfo.pageStatus
        if (pageStatus == 1) { //入库
            this.table_config = formJs.table_config1
        } else if (pageStatus == 2) {
            this.table_config = formJs.table_config2
        }
        actions.onGlobalStateChange((state, prev) => {
            var data = prev.currentUser.projects;
            this.userInfo = prev.currentUser
        }, true);

        this.btnShow = true
        if (this.primaryInfo.status == 7) { //查看
            this.formData.fId = this.primaryInfo.data.fId//按钮 
            this.getDetail({
                fId: this.primaryInfo.data.fId
            })
            this.btnShow = false
            this.formObj.map((item) => {
                item.disabled = true;
            });
        }

    },
    methods: {
     
       
        edit() {
            this.formData = this.$options.data.call(this).formData;
        },

        // 详情
        getDetail(obj) {
            this.loading=true;
            getSampleConserveByFid(obj).then((res) => {
                if (res.errcode == 0) {
                    this.loading=false;
                    var data = res.data.yjQmpYpCheckSampleconserve;
                    this.formData = data;
                    this.tableData = data.itemsList
                }else {
                    this.loading=false;
                

                    this.$message.error({
                        content:"res.msg",
                        duration: 1000
                    });
                }

            });
        },



    },
};